package com.control;


import com.hadoop.HadoopClient;
import com.service.IHadoopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

@RestController
@RequestMapping("/test")
public class HadoopController {

    @Autowired
    HadoopClient hadoopClient ;

    @Autowired
    IHadoopService iHadoopService ;

    @GetMapping("/hadoop")
    public void testSentinel(Long id) throws InterruptedException {

        try {
            hadoopClient.mkdir();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/hadoop2")
    public void testHadoop() throws InterruptedException {
        File  sourceFile=new File("E:\\hadoop\\啊啊.txt");
        File  okFile=new File("E:\\hadoop\\啊啊.txt.ok");
        iHadoopService.uploadFileToHadoop(sourceFile,okFile);
    }

    @GetMapping("/hadoop3")
    public void testHadoop(Long id) throws InterruptedException {

        String hadoop_user_name = System.getProperty("HADOOP_USER_NAME");

        System.out.println("==="+hadoop_user_name);

    }

}
